﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyBeeBullet : MonoBehaviour {
    [Header("向下速度")]
    public float Dspeed;

    private Animator an;

    private void OnTriggerEnter2D(Collider2D other)
    {
        an.SetBool("Hit", true);
        Destroy(gameObject, 0.2f);
        if (other.gameObject.tag == "Player")
        {
            Dspeed = 0;
            PlayerBloodController.con.SetBlood();
            PlayerController.con.PlayerHurt();
        }
    }
    // Use this for initialization
    void Start()
    {
        Invoke("SelfDestroy", 3f);
        an = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        transform.position += new Vector3(0, -Dspeed * Time.deltaTime, 0);
    }

    public void SelfDestroy()
    {
        Destroy(gameObject);
    }
}
